package com.best.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.best.entity.Employee;
import com.best.mapper.BaseMapper;
import com.best.mapper.EmployeeMapper;

@Service
public class EmployeeServiceImpl extends BaseServiceImpl<Employee, Integer> implements com.best.service.EmployeeService{

	@Resource
	private EmployeeMapper employeeMapper;

	@Override
	public BaseMapper<Employee, Integer> getMapper() {
		return employeeMapper;
	}

	@Override
	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
	public boolean test(Employee record) {
		employeeMapper.updateByPrimaryKeySelective(record);
		int i = 0;
		String str = String.valueOf(10 / i);
		record.setName("haole");
		employeeMapper.updateByPrimaryKeySelective(record);
		return true;
	}

	@Override
	public Employee findByPK(int i) {
		return employeeMapper.selectByPrimaryKey(i);
	}
}